#!/bin/bash

function gpio_x86_rst()
{
	echo -e "Perform X86 CPU RST:"

	/opt/rk/gpio.sh set 345 1 > /dev/null

	for (( i = 3; i > 0; i-- )); do
		echo -e ">>> ${i}"

		sleep 0.2
		/opt/rk/gpio.sh set 345 0 > /dev/null
		sleep 0.5
		/opt/rk/gpio.sh set 345 1 > /dev/null
	done

	echo -e "Done"
}

if [[ $(id -u) -ne 0 ]]; then
	echo -e "[ERROR] Please run as root!"
	exit 1
fi

gpio_x86_rst
